<?php
class Configuration {
    protected $_configs = array();
    public function __construct($configfile) {
        if (is_array($configfile) === false) {
            include($configfile);
            if (isset($configs))
                $this->_configs = $configs;
        } else {
            $this->_configs = $configfile;
        }
    }
    public function __get($key) {
        if (false == isset($this->_configs[$key]))
            throw new Exception("no such key:$key in your configuration file!");
        return $this->_configs[$key];
    }
    public function __isset($key) {
        return isset($this->_configs[$key]);
    }
    public function __set($key, $value) {
        $this->_configs[$key] = $value;
    }
    public function isNull()
    {
        return empty($this->_configs);
    }
}
